Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import { NextResponse } from 'next/server' import { withAuth } from '@/lib/auth/withAuth' import { findRelatedFlowcharts } from '@/lib/flowcharts/embedding-search' /** * GET /api/flowcharts/[id]/related * * Get flowcharts related to a specific flowchart. * Uses semantic similarity based on embeddings. * * Response: { related: FlowchartSearchResult[] } */ export const GET = withAuth(async (_request, { params }) => { try { const { id } = (await params) as { id: string } const related = await findRelatedFlowcharts(id, { limit: 5, minSimilarity: 0.4, // Lower threshold for related items }) return NextResponse.json({ related }) } catch (error) { console.error('Failed to find related flowcharts:', error) return NextResponse.json({ error: 'Failed to find related flowcharts' }, { status: 500 }) } }) |